﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using RoutingDaemon;
using System.Threading;
using IRC.Utilities;
using IRC.Utilities.Entities;

namespace IRCPhase2Tester.Daemons
{
    class ExternalRoutingDaemon : DaemonBase
    {
        Process process;
        public ExternalRoutingDaemon(int nodeID, string configurationFileName)
            : base(nodeID, configurationFileName)
        {

        }

        public override void Suspend()
        {
            base.Suspend();
        }

        public override void Start()
        {
            string arguments = string.Format("-i {0} -c {1}", this.NodeID.ToString(), "\"" + this.ConfigurationFileName + "\"");
            process = Process.Start(Session.Instance.RoutingDaemonPath, arguments);
        }

        public override void Kill()
        {
            if (!process.HasExited)
                process.Kill();
        }
    }
}
